﻿using System;
using System.Windows.Forms;
using Accounting.Model;

namespace EIM_Accounting
{
    public partial class CM010103 : Form
    {
        private string dateFlg = string.Empty;
        private int staffId = 0;
        private BLL.CM010103 cm010103;

        public CM010103(string flg, int stafcd)
        {
            InitializeComponent();
            dateFlg = flg;

            staffId = stafcd;
            cm010103 = new BLL.CM010103();

            if (dateFlg == "Out")
            {
                label1.Text = "离职日期";
                //.OutDate = dateTimePicker1.Value.ToString("yyyyMMdd");
            }
            else if (dateFlg == "Positive")
            {
                label1.Text = "转正日期";
                //staff.PositiveDate = dateTimePicker1.Value.ToString("yyyyMMdd");
            }
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            Staff staff = cm010103.getModel(staffId);

            if (dateFlg == "Out")
            {
                staff.OutDate = dateTimePicker1.Value.ToString("yyyyMMdd");
            }
            else if (dateFlg == "Positive")
            {
                staff.PositiveDate = dateTimePicker1.Value.ToString("yyyyMMdd");
            }

            cm010103.Update(staff);
            this.Close();
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void CM010103_Load(object sender, EventArgs e)
        {
        }
    }
}